package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.RoleDepartment;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RoleDepartmentDTO {

    private static final long serialVersionUID = 1L;

    private Integer id;

    @ApiModelProperty(value = "角色id")
    private Integer roleId;

    @ApiModelProperty(value = "选择部门id")
    private Integer departmentId;

    private Date updateTime;


    public RoleDepartmentDTO() {}

    public RoleDepartmentDTO(RoleDepartment entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static RoleDepartmentDTO convert(RoleDepartment entity) {
        return new RoleDepartmentDTO(entity);
    }

    public static List<RoleDepartmentDTO> convertList(List<RoleDepartment> list) {
        List<RoleDepartmentDTO> resultList = new ArrayList<>();
        for (RoleDepartment entity : list) {
            resultList.add(new RoleDepartmentDTO(entity));
        }
        return resultList;
    }}
